// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_INV_CHECKING_PLAN_ITEM
// * CreateDate    : 2011/8/16 10:16:40
// * Creater       : CodeSmith
// * LastChangeDate: 2011/8/16 10:16:40
// * LastChanger   : 2011/8/16 10:16:40
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Inv
{
/// <summary>
    /// InvCheckingPlanItem
    /// </summary>
    public partial class InvCheckingPlanItemBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objInvCheckingPlanItemEntity">Entity</param>
        /// <returns>Entity</returns>
        public static InvCheckingPlanItemEntity GetInvCheckingPlanItem(InvCheckingPlanItemEntity objInvCheckingPlanItemEntity)
        {
            return DataAccess.SelectSingle<InvCheckingPlanItemEntity>(objInvCheckingPlanItemEntity);
        }

        public static DataSet GetDataSetByCheckingId(string checkingId)
        {
            if (checkingId == null)
            {
                return null;
            }
            string sql = @"select A.*,E.WAREHOUSE_CODE,E.WAREHOUSE_NAME,G.PRODUCT_TYPE_NAME AS CLASS1,F.PRODUCT_TYPE_NAME AS CLASS2,C.PRODUCT_CODE,C.PRODUCT_NAME,D.NAME_CN 
                            from INV_CHECKING_PLAN_ITEM A
                            left join INV_CHECKING_PLAN B ON A.CHECKING_PLAN_ID=B.CHECKING_PLAN_ID
                            LEFT JOIN MST_PRODUCT C on A.PRODUCT_ID=C.PRODUCT_ID
                            left join MST_PERSON D On a.CHECKING_PERSON=D.PERSON_ID
                            left join MST_WAREHOUSE E on A.WAREHOUSE_CODE=e.WAREHOUSE_CODE
                            left join MST_PRODUCT_TYPE F ON F.PRODUCT_TYPE_ID=C.PRODUCT_TYPE_ID
                            left join MST_PRODUCT_TYPE G ON F.PARENT_TYPE_ID=G.PRODUCT_TYPE_ID
                            WHERE 1=1
                            AND a.CHECKING_PLAN_ID='" + checkingId + "'";
            return DataAccess.SelectDataSet(sql);
        }

        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objInvCheckingPlanItemEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertInvCheckingPlanItem(InvCheckingPlanItemEntity objInvCheckingPlanItemEntity)
        {
            return DataAccess.Insert(objInvCheckingPlanItemEntity);
        }

        public static bool InsertInvCheckingPlanItem(List<InvCheckingPlanItemEntity> objInvCheckingPlanItemEntityList)
        {
            return DataAccess.Insert(objInvCheckingPlanItemEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objInvCheckingPlanItemEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateInvCheckingPlanItem(InvCheckingPlanItemEntity objInvCheckingPlanItemEntity)
        {
            return DataAccess.Update(objInvCheckingPlanItemEntity);
        }

        public static bool UpdateInvCheckingPlanItem(List<InvCheckingPlanItemEntity> objInvCheckingPlanItemEntityList)
        {
            return DataAccess.Update<InvCheckingPlanItemEntity>(objInvCheckingPlanItemEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objInvCheckingPlanItemEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteInvCheckingPlanItem(InvCheckingPlanItemEntity objInvCheckingPlanItemEntity)
        {
            return DataAccess.Delete(objInvCheckingPlanItemEntity);
        }

        public static bool DeleteInvCheckingPlanItem(List<InvCheckingPlanItemEntity> objInvCheckingPlanItemEntityList)
        {
            return DataAccess.Delete<InvCheckingPlanItemEntity>(objInvCheckingPlanItemEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetInvCheckingPlanItemAll()
        {
            return DataAccess.SelectAllDataSet<InvCheckingPlanItemEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<InvCheckingPlanItemEntity> GetInvCheckingPlanItemAllList()
        {
            return DataAccess.SelectAll<InvCheckingPlanItemEntity>();
        }
        #endregion
	}
	
	
}	

